package com.lcxw.hxzb.friendcircle.project.system.controller;


import com.lcxw.hxzb.friendcircle.framework.web.controller.BaseController;
import com.lcxw.hxzb.friendcircle.framework.web.domain.AjaxResult;
import com.lcxw.hxzb.friendcircle.framework.web.page.TableDataInfo;
import com.lcxw.hxzb.friendcircle.project.system.domain.YwpdDistrict;
import com.lcxw.hxzb.friendcircle.project.system.service.IYwpdDistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 游戏区服Controller
 *
 * @author ruoyi
 * @date 2020-09-15
 */
@RestController
@RequestMapping("/system/district")
public class YwpdManageDistrictController extends BaseController
{
    @Autowired
    private IYwpdDistrictService ywpdDistrictService;

    /**
     * 查询游戏区服列表
     */
    @GetMapping("/list")
    public TableDataInfo list(YwpdDistrict ywpdDistrict)
    {
        startPage();
        List<YwpdDistrict> list = ywpdDistrictService.selectYwpdDistrictList(ywpdDistrict);
        return getDataTable(list);
    }
    @GetMapping("/lists")
    public AjaxResult lists(YwpdDistrict ywpdDistrict)
    {
        List<YwpdDistrict> list = ywpdDistrictService.selectYwpdDistrictList(ywpdDistrict);
        return AjaxResult.success(list);
    }

    /**
     * 获取游戏区服详细信息
     */
    @GetMapping(value = "/{districtId}")
    public AjaxResult getInfo(@PathVariable("districtId") Long districtId)
    {
        return AjaxResult.success(ywpdDistrictService.selectYwpdDistrictById(districtId));
    }

    /**
     * 新增游戏区服
     */
    @PostMapping
    public AjaxResult add(@RequestBody YwpdDistrict ywpdDistrict)
    {
        return toAjax(ywpdDistrictService.insertYwpdDistrict(ywpdDistrict));
    }

    /**
     * 修改游戏区服
     */
    @PutMapping
    public AjaxResult edit(@RequestBody YwpdDistrict ywpdDistrict)
    {
        return toAjax(ywpdDistrictService.updateYwpdDistrict(ywpdDistrict));
    }

    /**
     * 删除游戏区服
     */
    @DeleteMapping("/{districtIds}")
    public AjaxResult remove(@PathVariable Long[] districtIds)
    {
        return toAjax(ywpdDistrictService.deleteYwpdDistrictByIds(districtIds));
    }
}

